package com.guchenbo.spark.sql

import org.apache.spark.sql.{SaveMode, SparkSession}

/**
 * @author guchenbo
 * @date 2022/4/14
 */
object Csv2Parquet {

  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder().master("local").appName("demo").getOrCreate()

    val path: String = "/Users/guchenbo/score_test.csv"
    val df = spark.read.csv(path)


    df.write.mode(SaveMode.Overwrite).save("/Users/guchenbo/score_test.parquet")

    spark.read.parquet("/Users/guchenbo/score_test.parquet").show()
  }
}
